package com.example.qxfw.nyqx.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.qxfw.common.entity.ny.CropWeatherDistIndexlib;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("service")
public interface CropWeatherDistIndexlibMapper {

    @Select("select cropname, easyhappentype, disaeasyhappencondition, defendmeasure " +
            "from crop_weather_dist_indexlib " +
            "where (to_char(disastarttime, 'MM-dd') >= '${startTime}' AND to_char(disaendtime, 'MM-dd') <= '${endTime}') OR(to_char(disastarttime, 'MM-dd') <= '${startTime}' AND to_char(disaendtime, 'MM-dd') >= '{startTime}') OR(to_char(disastarttime, 'MM-dd') <= '${endTime}' AND to_char(disaendtime, 'MM-dd') >= '${endTime}') ")
    List<CropWeatherDistIndexlib> selectList(String startTime,String endTime);

    @Select("select easyhappentype, disaeasyhappencondition, defendmeasure " +
            "where crop_weather_dist_indexlib " +
            "where cropname like '%${cropName}%' and easyhappentype ='${easyHappenType}' ")
    List<CropWeatherDistIndexlib> selectList1(String cropName,String easyHappenType);
}
